from django.db import models


class ProjectMsg(models.Model):
    project_name = models.CharField(max_length=32, unique=True, null=False, verbose_name='项目名称')
    tasks = models.TextField(null=False, verbose_name='任务', help_text='该项目可执行哪些任务')

    # 人工工作站 robot_station
    available_robot_stations = models.TextField(null=True, blank=True, verbose_name='可用的人工工作站',
                                                help_text='添加项目时配置的可用人工工作站')
    assigned_robot_stations = models.TextField(null=True, blank=True, verbose_name='分配给了用户的人工工作站',
                                               help_text='属于available_stations的子集')
    # 输送线工作站 conveyor_station
    available_conveyor_stations = models.TextField(null=True, blank=True, verbose_name='可用的输送线工作站',
                                                   help_text='添加项目时配置的可用输送线工作站')
    assigned_conveyor_stations = models.TextField(null=True, blank=True, verbose_name='分配给了用户的输送线工作站',
                                                  help_text='属于available_conveyor_stations的子集')

    mysql_host = models.CharField(max_length=64, null=False, help_text='项目的mysql服务的ip或域名')
    robot_monitor_url = models.TextField(null=True, blank=True, verbose_name='监控机器人的url')
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    # robot、CONVEYOR conveyor
    class Meta:
        db_table = 'project_msg'


class Gui(models.Model):
    gui_version = models.CharField(max_length=32, null=False, verbose_name='gui最版本')
    gui_version_msg = models.TextField(null=False, verbose_name='gui最新版本信息')
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        db_table = 'gui'
